import request from "../utils/request.js"
import config from "../config/index.js"
// 获取轮播的接口
export const getweixinOpenId = (params) => {
	return request.get({
		url: '/public/index.php/api/Weixin/getweixin',
		data: params
	})
}

export const weixinLogin = (params) => {
	return request.post({
		url: '/public/index.php/api/Weixin/weixinLogin',
		data: params
	})
}


// https://apis.map.qq.com/ws/geocoder/v1/?location=39.0851,117.19937&key=KMFBZ-UQHEV-AU3PL-5NAN7-GTJB7-XXBOJ

export const getPositionMap = (params) => {
	// return request.post({url:'https://apis.map.qq.com/ws/geocoder/v1/?location=39.0851,117.19937&key=KMFBZ-UQHEV-AU3PL-5NAN7-GTJB7-XXBOJ',data:params})
	return new Promise((resolve,rej)=>{
		uni.request({
			url: "https://apis.map.qq.com/ws/geocoder/v1/",
			data: {
				location: params.lat + ',' + params.lng,
				key: config.MAP_KEY
			},
			success: (res) => {
				resolve(res.data)
				console.log(res);
				this.text = 'request success';
			}
		})
	})
	
}


// /Weixin/weixinLogin